#include <bits/stdc++.h>
using namespace std;
int n, m;

int main() {
	cin >> n >> m;
	int day = 0;
	while (n) {
		day++;
		n--;
		if (day % m == 0) {
			n++;
		}
	}
	cout << day << endl;
	return 0;
}